package com.example.demo.controller;

import com.example.demo.entity.Cla;
import com.example.demo.service.ClaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;

@RestController
@CrossOrigin
public class ClaController {

    @Autowired
    ClaService claService;

    @PostMapping("/Cla")
    public int save(@RequestBody Cla cla){
        return claService.save(cla);
    }

    @DeleteMapping("/Cla/{Classname}")
    public int delete(@PathVariable("Classname") int Classname){
        return claService.delete(Classname);
    }

    @PutMapping("/Cla")
    public int update(@RequestBody Cla cla){
        return claService.update(cla);
    }

    @GetMapping("/Cla")
    public List<Cla> select(){
        return claService.select();
    }
}
